//package com.wpp.Config;
//
//import com.alibaba.druid.pool.DruidDataSource;
//import com.wpp.config.ZkConfigCenter;
//import com.zaxxer.hikari.HikariDataSource;
//import org.springframework.context.annotation.Bean;
//import org.springframework.context.annotation.Configuration;
//
//import java.util.Properties;
//
//
///**
// * @Classname DataSourceConfig
// * @Description
// * @Date 2020/12/9 23:04
// * @Created by wpp25
// */
//@Configuration
//public class DataSourceConfig {
//
//    @Bean
//    public DynamicDataSource dynamicDataSource(ZkConfigCenter configCenter) {
////        HikariDataSource hikariDataSource = new HikariDataSource();
//        DruidDataSource druidDataSource = new DruidDataSource();
//
//        Properties properties = configCenter.loadConfig();
//
//        // 设置hikariDataSource的连接信息
//        druidDataSource.setDriverClassName(properties.getProperty("spring.datasource.driver-class-name"));
//        druidDataSource.setUrl(properties.getProperty("spring.datasource.url"));
//        druidDataSource.setUsername(properties.getProperty("spring.datasource.username"));
//        druidDataSource.setPassword(properties.getProperty("spring.datasource.password"));
//
//        System.out.println("DataSourceConfig, 配置数据源成功");
//        return new DynamicDataSource(druidDataSource);
//    }
//
//}
